package com.cadre.system.service.impl;

import com.cadre.common.utils.oldutil.DateUtil;
import com.cadre.system.domain.officer.A37;
import com.cadre.system.domain.officer.TrainInfo;
import com.cadre.system.mapper.A37Mapper;
import com.cadre.system.service.TrainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service("trainService")
public class TrainServiceImpl implements TrainService {
    @Autowired
    private A37Mapper a37Mapper;

    @Override // com.tdqy.cadre.modular.profess.service.TrainService
    public List<TrainInfo> trainMsg(String personid) {
        List<TrainInfo> trainInfos = new ArrayList<>();
        List<A37> a37s = this.a37Mapper.selectByPersonid(personid);
        if (a37s.size() != 0) {
            for (int i = 0; i < a37s.size(); i++) {
                TrainInfo trainInfo = new TrainInfo();
                trainInfo.setFlowid(a37s.get(i).getFlowid());
                trainInfo.setPersonid(a37s.get(i).getPersonid());
                trainInfo.setA3735(a37s.get(i).getA3735());
                trainInfo.setA3736(a37s.get(i).getA3736());
                trainInfo.setA3743(DateUtil.dateToStr(a37s.get(i).getA3743()));
                trainInfo.setA3754(DateUtil.dateToStr(a37s.get(i).getA3754()));
                trainInfo.setA3766(a37s.get(i).getA3766().shortValue());
                trainInfos.add(trainInfo);
            }
        } else {
            System.out.println("--------------------A37 null-----------------------");
        }
        return trainInfos;
    }
}
